home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-08-27 | 5.4 KB | 143 lines | [TEXT/MPS ] |
- // Copyright © 1990 Apple Computer, Inc. All rights reserved.
- #ifndef __IACHeaders__ // Every source file which uses the headers defined
- #include "IACHeaders.h" // In the main header file get the file included.
- #endif
-
-
- /**********************************Comment*****************************************
- * TSDRVROpen is called by the assembly TSEOpen routine. It in turn will just turn
- * around and call the TDriver::IACOpen method after some setup.
- * This routine must instantiate the TDriver object. We'll be good heap users
- * and move the object (handle) hi. If we get an error, we'll return
- * MemErr, mostly for debugging purposes. Declared as extern "C" in DriverWrapper.h
- **********************************End Comment************************************/
-
- OSErr
- TSDRVROpen(ParmBlkPtr oParmBlock,DCtlPtr tsDCEPtr)
- {
- TDrvrPtr aDrvrPtr;
- OSErr err;
-
- // Create TDriver object
- aDrvrPtr = new(TDriver);
-
- // make dCtlStorage point to it.
- tsDCEPtr->dCtlStorage = (Handle) aDrvrPtr;
- if(tsDCEPtr->dCtlStorage)
- {
- MoveHHi(tsDCEPtr->dCtlStorage);
- HLock(tsDCEPtr->dCtlStorage);
- aDrvrPtr = (TDrvrPtr) tsDCEPtr->dCtlStorage;
- err = aDrvrPtr->iacOpen(oParmBlock); // Call the iacOpen() method.
- HUnlock(tsDCEPtr->dCtlStorage);
- return(err);
- }
- else
- return MemError();
- }
-
- /**********************************Comment*****************************************
- * TSDRVRPrime is called by the assembly TSEPrime routine. It in turn will just turn
- * around and call the TDriver::IACPrime method after locking the object.
- * This essentially just locks the handle whose master pointer points to the object,
- * and then will call the appropriate method. When done, it'll unlock the handle.
- **********************************End Comment************************************/
- OSErr
- TSDRVRPrime(ParmBlkPtr pParmBlock,DCtlPtr tsDCEPtr)
- {
- TDrvrPtr aDrvrPtr;
- OSErr err;
-
- HLock(tsDCEPtr->dCtlStorage); // Lock the storage handle
- aDrvrPtr = (TDrvrPtr) tsDCEPtr->dCtlStorage; // Object pointer = master pointer
- err = aDrvrPtr->iacPrime(pParmBlock); // Call the iacPrime() method.
- HUnlock(tsDCEPtr->dCtlStorage); // Unlock the handle.
- return(err);
- }
-
-
- /**********************************Comment*****************************************
- * TSDRVRControl is called by the assembly TSEControl routine. It in turn will just turn
- * around and call the TDriver::IACControl method after locking the object.
- * This essentially just locks the handle whose master pointer points to the object,
- * and then will call the appropriate method. When done, it'll unlock the handle.
- **********************************End Comment************************************/
-
- OSErr
- TSDRVRControl(ParmBlkPtr cntlParmBlock,DCtlPtr tsDCEPtr)
- {
- TDrvrPtr aDrvrPtr;
- OSErr err;
-
- HLock(tsDCEPtr->dCtlStorage); // Lock the storage handle
- aDrvrPtr = (TDrvrPtr) tsDCEPtr->dCtlStorage; // Object pointer = master pointer
- err = aDrvrPtr->iacControl(cntlParmBlock); // Call the iacControl() method
- HUnlock(tsDCEPtr->dCtlStorage); // Unlock the handle.
- return(err);
- }
-
-
- /**********************************Comment*****************************************
- * TSDRVRStatus is called by the assembly TSEStatus routine. It in turn will just turn
- * around and call the TDriver::IACStatus method after locking the object.
- * This essentially just locks the handle whose master pointer points to the object,
- * and then will call the appropriate method. When done, it'll unlock the handle.
- **********************************End Comment************************************/
-
- OSErr
- TSDRVRStatus(ParmBlkPtr sParmBlock,DCtlPtr tsDCEPtr)
- {
- TDrvrPtr aDrvrPtr;
- OSErr err;
-
- HLock(tsDCEPtr->dCtlStorage); // Lock the storage handle
- aDrvrPtr = (TDrvrPtr) tsDCEPtr->dCtlStorage; // Object pointer = master pointer
- err = aDrvrPtr->iacStatus(sParmBlock); // Call the iaStatus() method
- HUnlock(tsDCEPtr->dCtlStorage); // Unlock the handle.
- return(err);
- }
-
-
- /**********************************Comment*****************************************
- * TSDRVRClose is called by the assembly TSEClose routine. It in turn will just turn
- * around and call the TDriver::IACClose method after locking the object.
- * This essentially just locks the handle whose master pointer points to the object,
- * and then will call the appropriate method. When done, it'll unlock the handle,
- * and dispose of the handle created at open time.
- **********************************End Comment************************************/
-
- OSErr
- TSDRVRClose(ParmBlkPtr cParmBlock,DCtlPtr tsDCEPtr)
- {
- TDrvrPtr aDrvrPtr;
- OSErr err;
-
- HLock(tsDCEPtr->dCtlStorage); // Lock the storage handle
- aDrvrPtr = (TDrvrPtr) tsDCEPtr->dCtlStorage; // Object pointer = master pointer
- err = aDrvrPtr->iacClose(cParmBlock); // Call the iacClose() method
- HUnlock(tsDCEPtr->dCtlStorage); // Unlock the handle.
- delete(aDrvrPtr); // Clean up after ourselves.
- return(err);
- }
-
-
-
- /**********************************Comment*****************************************
- * tseStrCpy is used by the TDriver and TMessage methods. It simply takes a source
- * string (s) and copies that to the destination string (d). It returns the
- * destination string.
- **********************************End Comment************************************/
- char*
- tseStrCpy(char *d,char *s)
- {
- short i = 0;
-
- while ( (i < 255) && (s[i] != kZeroChar) )
- {
- d[i] = s[i];
- i++;
- }
- d[i] = '\0';
- return (d);
- }
-